#include <bits/stdc++.h>

using namespace std;

class Solution {
   public:
    vector<int> canSeePersonsCount(vector<int>& heights) {
        vector<int> ans;
        for (int i = 0; i < heights.size(); ++i) {
            stack<int> st;
            for (int j = i + 1; j < heights.size(); ++j) {

                if (st.empty()) {
                    st.push(heights[j]);
                }
                else if (heights[j] > st.top()){
                    st.push(heights[j]);
                }
                if (heights[j] >= heights[i]){
                    break;
                }
            }
            ans.push_back(st.size());
        }
        return ans;
    }
};